<template>
  <div class="root">
    <div class="item">
      <div >
        <span class="demonstration ">配置渔方投喂时间段设置  :   </span>
        <el-date-picker
          v-model="value"
          type="daterange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          @change="timeClick"
          value-format="yyyy-MM-dd"
        >
        </el-date-picker>
      </div>
    </div>
  </div>
</template>
<script>
import { saveFishPartyFeedTime } from "@/api/user";
import { Toast } from "vant";
export default {
  data() {
    return {
      value: ""
    };
  },
  methods: {
    async timeClick() {
      let data = {
        beginTime: this.value[0],
        endTime: this.value[1]
      };
      let result = await saveFishPartyFeedTime(data);
      if (result.code == 0) {
        Toast.success("投喂时间段添加成功");
      } else {
        Toast.fail("添加失败");
      }
    }
  }
};
</script>
<style lang="scss" scoped>
.root {
	text-align: center;
	vertical-align: middle;
    margin: 15% auto;
}

</style>
